#include <cstdio>
#include <algorithm>
using namespace std;
const int N=100050;
//const int MOD=1e9+7;
const int MOD=7;
char s[N];
long long qPow(long long a,long long k){
    long long sum=1;
    while(k){
        if(k%2){
            sum=(sum*a)%MOD;
        }
        a=a*a%MOD;
        k>>=1;
    }
    return sum;
}
int main(void){
    while(~scanf("%s",s)){
        long long sum=0;
        int i=0;
        while(s[i]){
            sum=(sum*10+s[i]-'0')%(MOD-1);
            i++;
        }
        printf("%lld\n",sum);
        //这里减1的原因是因为有个第一项
        long long n=sum-1;
        printf("%lld\n",qPow(2,n));
    }
    return 0;
}